home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CD-ROM Now 11
/
CD-ROM Now MegaDisc 11 (1995-02).iso
/
discs
/
cica
/
winben.exe
/
WINBENCH.MS_
/
WINBENCH.MS
Wrap
Text File
|
1993-10-25
|
8KB
|
286 lines
'**************************************************************************
'* MSSetup Toolkit Sample 1
'**************************************************************************
'$DEFINE DEBUG ''Define for script development/debugging
'$INCLUDE 'setupapi.inc'
'$INCLUDE 'msdetect.inc'
''Dialog ID's
CONST WELCOME = 100
CONST ASKQUIT = 200
CONST DESTPATH = 300
CONST EXITFAILURE = 400
CONST EXITQUIT = 600
CONST EXITSUCCESS = 700
CONST EXITRESTART = 750
CONST OPTIONS = 800
CONST APPHELP = 900
CONST BADPATH = 6400
CONST TRUE = -1
CONST FALSE = 0
''Bitmap ID
CONST LOGO = 1
GLOBAL DEST$ ''Default destination directory.
GLOBAL OPTCUR$ ''Option selection from option dialog.
GLOBAL DestDrive$
GLOBAL PRODUCTNAME$
GLOBAL WinDrive$
DECLARE SUB Install
DECLARE FUNCTION CheckSpace () AS INTEGER
DECLARE FUNCTION MakePath (szDir$, szFile$) AS STRING
INIT:
PRODUCTNAME$ = "WinBench 4.0"
CUIDLL$ = "mscuistf.dll" ''Custom user interface dll
HELPPROC$ = "FHelpDlgProc" ''Help dialog procedure
SetBitmap CUIDLL$, LOGO
SetTitle PRODUCTNAME$ + " Setup"
szInf$ = GetSymbolValue("STF_SRCINFPATH")
IF szInf$ = "" THEN
szInf$ = MakePath(GetSymbolValue("STF_CWDDIR"),"WINBENCH.INF")
END IF
ReadInfFile szInf$
OPTCUR$ = "1"
DEST$ = "C:\WINBENCH"
WinDrive$ = MID$(GetWindowsDir, 1, 1)
IF IsDriveValid(WinDrive$) = 0 THEN
i% = DoMsgBox("Windows drive ('"+WinDrive$+"') is not a valid drive.", "DEBUG", MB_TASKMODAL+MB_ICONHAND+MB_OK)
GOTO QUIT
END IF
WELCOME:
sz$ = UIStartDlg(CUIDLL$, WELCOME, "FInfoDlgProc", APPHELP, HELPPROC$)
IF sz$ = "CONTINUE" THEN
UIPop 1
ELSE
GOSUB ASKQUIT
GOTO WELCOME
END IF
GETPATH:
SetSymbolValue "EditTextIn", DEST$
SetSymbolValue "EditFocus", "END"
GETPATHL1:
sz$ = UIStartDlg(CUIDLL$, DESTPATH, "FEditDlgProc", APPHELP, HELPPROC$)
DEST$ = GetSymbolValue("EditTextOut")
IF sz$ = "CONTINUE" THEN
DestDrive$ = MID$(DEST$, 1, 1)
IF IsDriveValid(DestDrive$) = 0 THEN
GOSUB BADPATH
GOTO GETPATHL1
END IF
IF IsDirWritable(DEST$) = 0 THEN
GOSUB BADPATH
GOTO GETPATHL1
END IF
UIPop 1
ELSEIF sz$ = "REACTIVATE" THEN
GOTO GETPATHL1
ELSEIF sz$ = "BACK" THEN
GOTO GETPATHL1
ELSE
GOSUB ASKQUIT
GOTO GETPATH
END IF
IF CheckSpace() = FALSE THEN
GOTO GETPATH
END IF
Install
QUIT:
ON ERROR GOTO ERRQUIT
IF ERR = 0 THEN
IF RestartListEmpty() = 0 THEN
dlg% = EXITRESTART
ELSE
dlg% = EXITSUCCESS
END IF
ELSEIF ERR = STFQUIT THEN
dlg% = EXITQUIT
ELSE
dlg% = EXITFAILURE
END IF
QUITL1:
sz$ = UIStartDlg(CUIDLL$, dlg%, "FInfo0DlgProc", 0, "")
IF sz$ = "REACTIVATE" THEN
GOTO QUITL1
END IF
UIPop 1
IF dlg% = EXITRESTART THEN
j% = ExitExecRestart()
END IF
END
ERRQUIT:
i% = DoMsgBox("Setup sources were corrupted, call ZDBOp!", "Setup Message", MB_OK+MB_TASKMODAL+MB_ICONHAND)
END
BADPATH:
sz$ = UIStartDlg(CUIDLL$, BADPATH, "FInfo0DlgProc", 0, "")
IF sz$ = "REACTIVATE" THEN
GOTO BADPATH
END IF
UIPop 1
RETURN
ASKQUIT:
sz$ = UIStartDlg(CUIDLL$, ASKQUIT, "FQuitDlgProc", 0, "")
IF sz$ = "EXIT" THEN
UIPopAll
ERROR STFQUIT
ELSEIF sz$ = "REACTIVATE" THEN
GOTO ASKQUIT
ELSE
UIPop 1
END IF
RETURN
'**
'** Purpose:
'** Builds the copy list and performs all installation operations.
'** Arguments:
'** none.
'** Returns:
'** none.
'*************************************************************************
STATIC FUNCTION CheckSpace() AS INTEGER
SrcDir$ = GetSymbolValue("STF_SRCDIR")
ClearCopyList
AddSectionFilesToCopyList "Files", SrcDir$, DEST$
AddSectionFilesToCopyList "System", SrcDir$, GetWindowsSysDir()
AddSectionFilesToCopyList "Suites", SrcDir$, MakePath(DEST$,"SUITES")
AddSectionFilesToCopyList "Results", SrcDir$, MakePath(DEST$,"RESULTS")
AddSectionFilesToCopyList "Doc", SrcDir$, MakePath(DEST$,"DOC")
FOR i% = 1 TO 26 STEP 1
AddListItem "EXTRA", "0"
NEXT i%
wd% = ASC(ucase$(WinDrive$)) - ASC("A") + 1
dd% = ASC(ucase$(DestDrive$)) - ASC("A") + 1
ReplaceListItem "EXTRA", wd%, "10240"
spaceNeeded& = GetCopyListCost("EXTRA","COST","NEEDED")
IF spaceNeeded& = 0 THEN
CheckSpace = TRUE
ELSE
CheckSpace = FALSE
w& = VAL(GetListItem("NEEDED",wd%))
d& = VAL(GetListItem("NEEDED",dd%))
m$ = "There is not enough disk space to install WinBench."
IF d& > 0 THEN
m$ = m$ + CHR$(10) + CHR$(10)
m$ = m$ + "You need an additional " + STR$((d&+999)/1000) + " kilobytes on drive " + DestDrive$ + "."
m$ = m$ + " Choose another installation drive, or free additional space on drive " + DestDrive$ + "."
END IF
IF (w& > 0) AND (wd% <> dd%) THEN
m$ = m$ + CHR$(10) + CHR$(10)
m$ = m$ + "You must free an additional " + STR$((w&+999)/1000) + " kilobytes on drive " + WinDrive$
m$ = m$ + " before installing WinBench."
END IF
i% = DoMsgBox(m$,"Insufficient Disk Space",MB_TASKMODAL+MB_OK+MB_ICONHAND)
END IF
END FUNCTION
STATIC SUB Install
CreateDir DEST$, cmoNone
CreateDir MakePath(DEST$,"SUITES"), cmoNone
CreateDir MakePath(DEST$,"RESULTS"), cmoNone
CreateDir MakePath(DEST$,"DOC"), cmoNone
SetRestartDir DEST$
LabFile$ = MakePath(DEST$,"WBLAB.DLL")
IF DoesFileExist(LabFile$,femExists) = 1 THEN
RemoveFile LabFile$,cmoNone
END IF
CopyFilesInCopyList
unName$ = MakePath(DEST$, "UNINSTAL.BAT")
un% = FreeFile
OPEN unName$ FOR APPEND AS # un%
PRINT # un%, ""
PRINT # un%, "SET WINDIR=" + MakePath(GetWindowsDir(),"")
PRINT # un%, "SET SYSDIR=" + MakePath(GetWindowsSysDir(),"")
PRINT # un%, "SET WBDIR=" + MakePath(DEST$,"")
PRINT # un%, "SET WBDRIVE=" + DestDrive$
PRINT # un%, "GOTO START"
PRINT # un%, ":DONE"
CLOSE # un%
IniFile$ = MakePath(GetWindowsDir(),"winbench.ini")
'IF DoesFileExist(IniFile$,femReadWrite) = 1 THEN
'RemoveFile IniFile$,cmoNone
'END IF
IF DoesIniSectionExist(IniFile$,"Registration") THEN
RemoveIniSection IniFile$,"Registration",cmoNone
END IF
CreateProgmanGroup "Ziff-Davis Benchmarks", "", cmoNone
ShowProgmanGroup "Ziff-Davis Benchmarks", 1, cmoNone
CreateProgmanItem "Ziff-Davis Benchmarks", PRODUCTNAME$, MakePath(DEST$,"winbench.exe"), "", cmoOverwrit
END SUB
'**
'** Purpose:
'** Appends a file name to the end of a directory path,
'** inserting a backslash character as needed.
'** Arguments:
'** szDir$ - full directory path (with optional ending "\")
'** szFile$ - filename to append to directory
'** Returns:
'** Resulting fully qualified path name.
'*************************************************************************
FUNCTION MakePath (szDir$, szFile$) STATIC AS STRING
IF szDir$ = "" THEN
MakePath = szFile$
ELSEIF szFile$ = "" THEN
IF MID$(szDir$, LEN(szDir$), 1) = "\" THEN
MakePath = MID$(szDir$, 1, LEN(szDir$)-1)
ELSE
MakePath = szDir$
END IF
ELSEIF MID$(szDir$, LEN(szDir$), 1) = "\" THEN
MakePath = szDir$ + szFile$
ELSE
MakePath = szDir$ + "\" + szFile$
END IF
END FUNCTION